#include "mainwidget.h"

MainWidget::MainWidget(QWidget *parent)
    : QWidget(parent)
{
    layout = new QGridLayout(this);

    lblGameWindow = new GameWindowLabel(this);

    btnStart = new QPushButton("开 始", this);
    btnStart->setFixedHeight(40);

    btnPause = new QPushButton("暂 停", this);
    btnPause->setFixedHeight(40);


    layout->addWidget(lblGameWindow, 0, 0, 1, 2);
    layout->addWidget(btnStart, 1, 0);
    layout->addWidget(btnPause, 1, 1);

    layout->setMargin(0);
    layout->setSpacing(0);

    setFixedSize(1080, 1080);
    setWindowTitle("守卫战舰");

    connect(btnStart, &QPushButton::clicked, this, [=](){
        qDebug() << "btnStart clicked";

        lblGameWindow->generateWords(10);

    });

}


void MainWidget::keyPressEvent(QKeyEvent *ev) {
    //qDebug() << ev->text();
    lblGameWindow->getKey(ev->text());
}

MainWidget::~MainWidget()
{
}

